const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    entry:'./src/main.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'my-first-webpack.bundle.js'
    },
    devtool: 'inline-source-map',
    devServer: {
      static: './dist',
      port:'3000',
      proxy: {
        '/api': {
          target: 'http://localhost:3001',
          pathRewrite: { '^/api': '' },
        },
      },
    },
    plugins: [
      new HtmlWebpackPlugin({
        title: '管理输出',
        template:'./src/index.html'
      }),
    ],
    module: {
        rules: [
          {
            test: /\.css$/i,
            use: ['style-loader', 'css-loader'],
          },
        ],
      },
      mode:'development'
}